package com.swt.gap.util.excel;

import com.alibaba.excel.EasyExcel;


public class ExcelReader {

    public ExcelData read(String filePath, Integer startRowIndex, Integer endRowIndex) {

        HeaderAndDataListener listener = new HeaderAndDataListener(startRowIndex, endRowIndex);
        EasyExcel.read(filePath, listener).sheet().doRead();
        return new ExcelData(listener.getHeaderList(), listener.getDataList(), listener.getFieldsMap());
    }

    public ExcelData read(String filePath) {

        HeaderAndDataListener listener = new HeaderAndDataListener();
        EasyExcel.read(filePath, listener).sheet().doRead();
        return new ExcelData(listener.getHeaderList(), listener.getDataList(), listener.getFieldsMap());
    }
}
